﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace PrisonStep
{
    public class Bazooka
    {
        #region MemberVariables

        private enum States { Stance, Walkstart, Walkloop, Salute, CatchEat };

        /// <summary>
        /// The animation model for the Bazooka
        /// </summary>
        private AnimatedModel mModel;

        /// <summary>
        /// Our Game
        /// </summary>
        private PrisonGame mGame;

        /// <summary>
        /// The player transformation matrix. Places the player where they need to be.
        /// </summary>
        private Matrix transform;

        private PieFire mPieFire;

        #endregion

        #region Properties

        public Matrix BazookaTransform { get { return transform; } set { transform = value; } }

        public float SlimeWeight { get { return mModel.SlimeWeight; } set { mModel.SlimeWeight = value; } }

        public PieFire PieFire { get { return mPieFire; } }

        public string Region { get { return mModel.Region; } set { mModel.Region = value; } }

        public int Adjacent { get { return mModel.Adjacent; } set { mModel.Adjacent = value; } }
        #endregion

        public Bazooka(PrisonGame aGame)
        {
            this.mGame = aGame;

            mModel = new AnimatedModel(aGame, "PieBazooka");
            mModel.Skinned = false;

            mPieFire = new PieFire(this.mGame);
        }

        public void LoadContent(ContentManager aContent)
        {
            mModel.LoadContent(aContent);

            mPieFire.LoadContent(aContent);
        }

        /// <summary>
        /// This function is called to update this component
        /// to the current game time
        /// </summary>
        /// <param name="aGameTime"></param>
        public void Update(GameTime aGameTime)
        {
            double lDeltaTotal = aGameTime.ElapsedGameTime.TotalSeconds;

            mModel.Region = mGame.Victoria.Region;


            mPieFire.Update(aGameTime);

        }

        /// <summary>
        /// This function is called to draw this game component
        /// </summary>
        /// <param name="aGraphics">Devicet to draw the model on.</param>
        /// <param name="aGameTime">Currentgame time.</param>
        /// <param name="aTransform">Transform that puts the model where we want it.</param>
        public void Draw(GraphicsDeviceManager aGraphics, GameTime aGameTime, Matrix aTransform)
        {
            mModel.Draw(aGraphics, aGameTime, aTransform);

            mPieFire.Draw(aGraphics, aGameTime, aTransform);
        }

        public void FireBazooka(int flyMode)
        {
            mPieFire.FirePie(flyMode);
        }

        public void ReloadBazooka()
        {
            mPieFire.Reload();
        }
    }
}